# 9.13
from random import randint

class Die:
    def __init__(self,sides=6):     # 初始化骰子
        self.sides = sides          # 返回一个位于 1 和骰子面数之间的随机数

    def roll_die(self):
        return randint(1,self.sides)

d6 = Die()
results = []
for roll_num in range(10):
    result = d6.roll_die()
    results.append(result)

print("\n10 rolls of a 6-sided die:")
print(results)


d10 = Die(sides=10)                 # 创建一个 10 面的骰子，再掷 10 次并显示结果
results2 = []
for roll_num in range(10):
    result2 = d10.roll_die()
    results2.append(result2)

print("\n10 rolls of a 10-sided die:")
print(results2)


d20 = Die(sides=20)
results3 = []
for roll_num in range(10):
    result3 = d20.roll_die()
    results3.append(result3)

print("\n10 rolls of a 20-sided die:")
print(results3)